const Koa = require('koa')
const app = new Koa()
const fs = require('fs')


const main = (ctx) => {
    if (ctx.url === '/') {
        ctx.body = 'hello world'
    } else if (ctx.url === '/home') {
        ctx.body = 'hello home'
    } else if (ctx.url === '/about') {
        const content = fs.readFileSync('./about.html', 'utf-8')
        ctx.body = content

        // const content = fs.readFileSync('./about.html')
        // ctx.body = content.toString()

        // const content = fs.createReadStream('./about.html')
        // ctx.body = content
    }
}
app.use(main)

app.listen(3000, ()=> {
    console.log('listening on 3000');
})